t = int(input())
ans =[]
for _ in range(t):
n,m = tuple(map(int, input().split()))
if m>=n:
if n%2==1:
s = '1 '*(n-1)
s+=str(m-(n-1))
ans.append("Yes\n"+s)
elif n%2==0 and m%2==0:
s = '1 '*(n-2)
s+= str((m-(n-2))//2) + ' ' + str((m-(n-2))//2)
ans.append("Yes\n"+s)
else:
ans.append("No")
else:
ans.append("No")
for i in ans:
print(i)
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
int mod = 1e9+7;
const int INF = 4e18;
// int INF = 1e9;
void print(int x){
cout << x << "\n";
}
void print(int x, int y){
cout << x << ' ' << y << "\n";
}
void print(int x, int y, int z){
cout << x << ' ' << y << ' ' << z << "\n";
}
void print(vector<int> x){
for (auto val: x) cout << val << ' ';
cout << endl;
}
void print(array<int, 2> x){
cout << x[0] << ' ' << x[1] << endl;
}
void print(vector<vector<int>> x){
for (auto val: x) print(val);
}
void print(vector<array<int, 2>> x){
for (auto [a, b]: x) cout << a << ' ' << b << endl;
}
void print(set<int> x){
for (auto val: x) cout << val << ' ';
cout << endl;
}
void print(multiset<int> x){
for (auto val: x) cout << val << ' ';
cout << endl;
}
void print(map<int, int> &x){
for (auto &[a, b]: x) cout << a << ' ' << b << endl;
}
int log2_floor(int i) {
return i ? __builtin_clzll(1) - __builtin_clzll(i) : -1;
}
int inv(int a, int b){
return 1<a ? b - inv(b%a,a)*b/a : 1;
}
int inv(int a){
return inv(a, mod);
}
vector<int> fact;
vector<int> ifact;
int bin(int N, int K){
if (K>N) return 0;
if (K<0) return 0;
if (N<0) return 0;
int res = 1;
res *= fact[N]; res %= mod;
res *= ifact[K]; res %= mod;
res *= ifact[N-K]; res %= mod;
return res;
}
void inv_init(int C = 1e6){
fact.resize(C+1); fact[0] = 1;
ifact.resize(C+1);
for (int i=1; i<=C; i++) fact[i] = (i*fact[i-1])%mod;
ifact[C] = inv(fact[C]);
for (int i=C-1; i>=0; i--) ifact[i] = ((i+1)*ifact[i+1])%mod;
}
int binpow(int a, int b) {
a %= mod;
long long res = 1;
while (b > 0) {
if (b & 1)
res = res * a % mod;
a = a * a % mod;
b >>= 1;
}
return res;
}
void solve() {
int n, m; cin >> n >> m;
if (m<n){
cout << "NO\n";return;
}
if (m%2==1 && n%2==0){
cout << "NO\n";return;
}
cout << "YES\n";
if (n==1){
cout << m << "\n";return;
}
if (m%2==0){
for (int i=0; i<n-2; i++){
cout << 1 << ' ';
}
if (n%2==0){
cout << (m-(n-2))/2 << ' ' << (m-(n-2))/2 << "\n";
}
else{
cout << 1 << ' ' << (m-(n-1)) << "\n";
}
}
else{
for (int i=0; i<n-2; i++){
cout << 1 << ' ';
}
cout << 1 << ' ' << (m-(n-1)) << "\n";
}
}
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
// inv_init();
int tt; cin >> tt;
for (int xx=1; xx<=tt; xx++)
solve();
}
e-maze-in | Bricks Game |
Char Sum | Two Strings |
Anagrams | Prime Number |
Lexical Sorting Reloaded | 1514A - Perfectly Imperfect Array |
580A- Kefa and First Steps | 1472B- Fair Division |
996A - Hit the Lottery | MSNSADM1 Football |
MATCHES Playing with Matches | HRDSEQ Hard Sequence |
DRCHEF Doctor Chef | 559. Maximum Depth of N-ary Tree |
821. Shortest Distance to a Character | 1441. Build an Array With Stack Operations |
1356. Sort Integers by The Number of 1 Bits | 922. Sort Array By Parity II |
344. Reverse String | 1047. Remove All Adjacent Duplicates In String |
977. Squares of a Sorted Array | 852. Peak Index in a Mountain Array |
461. Hamming Distance | 1748. Sum of Unique Elements |
897. Increasing Order Search Tree | 905. Sort Array By Parity |
1351. Count Negative Numbers in a Sorted Matrix | 617. Merge Two Binary Trees |